

export const formatFileSize = (fileSize: number): string => {
    if (fileSize < 1024) {
        return fileSize + ' B';
    } else if (fileSize < (1024 * 1024)) {
        return (fileSize / 1024).toFixed(2) + ' KB';
    } else if (fileSize < (1024 * 1024 * 1024)) {
        return (fileSize / (1024 * 1024)).toFixed(2) + ' MB';
    } else {
        return (fileSize / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
    }
}


export const formatDate = (date: Date): string => {
    let month = date.getMonth() + 1;
    let date0 = date.getDate();
    let minutes = date.getMinutes();
    let hours = date.getHours();
    return date.getFullYear() + "-" + (month < 10 ? "0" + month : month) + "-" + (date0 < 10 ? "0" + date0 : date0) + " " + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes);
}
